Import libraries¶

In [1]:
import pandas as pd
import numpy as np 
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go

Read a dataset¶

In [2]:
df = pd.read_csv(r"C:\Users\Vaishnavi Daule\Downloads\archive (20)\apple_products.csv")
In [3]:
df
Out[3]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
... ... ... ... ... ... ... ... ... ... ... ...
57 APPLE iPhone SE (Black, 64 GB) https://www.flipkart.com/apple-iphone-se-black... Apple 29999 39900 24 95909 8161 MOBFWQ6BR3MK7AUG 4.5 4 GB
58 APPLE iPhone 11 (Purple, 64 GB) https://www.flipkart.com/apple-iphone-11-purpl... Apple 46999 54900 14 43470 3331 MOBFWQ6BTFFJKGKE 4.6 4 GB
59 APPLE iPhone 11 (White, 64 GB) https://www.flipkart.com/apple-iphone-11-white... Apple 46999 54900 14 43470 3331 MOBFWQ6BVWVEH3XE 4.6 4 GB
60 APPLE iPhone 11 (Black, 64 GB) https://www.flipkart.com/apple-iphone-11-black... Apple 46999 54900 14 43470 3331 MOBFWQ6BXGJCEYNY 4.6 4 GB
61 APPLE iPhone 11 (Red, 64 GB) https://www.flipkart.com/apple-iphone-11-red-6... Apple 46999 54900 14 43470 3331 MOBFWQ6BYYV3FCU7 4.6 4 GB

62 rows × 11 columns

In [4]:
df.head(3)
Out[4]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
In [5]:
df.tail(3)
Out[5]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
59 APPLE iPhone 11 (White, 64 GB) https://www.flipkart.com/apple-iphone-11-white... Apple 46999 54900 14 43470 3331 MOBFWQ6BVWVEH3XE 4.6 4 GB
60 APPLE iPhone 11 (Black, 64 GB) https://www.flipkart.com/apple-iphone-11-black... Apple 46999 54900 14 43470 3331 MOBFWQ6BXGJCEYNY 4.6 4 GB
61 APPLE iPhone 11 (Red, 64 GB) https://www.flipkart.com/apple-iphone-11-red-6... Apple 46999 54900 14 43470 3331 MOBFWQ6BYYV3FCU7 4.6 4 GB

EDA(Exploratory Data Analysis)¶

Check datatype¶

In [6]:
df.info()      
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 62 entries, 0 to 61
Data columns (total 11 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Product Name         62 non-null     object 
 1   Product URL          62 non-null     object 
 2   Brand                62 non-null     object 
 3   Sale Price           62 non-null     int64  
 4   Mrp                  62 non-null     int64  
 5   Discount Percentage  62 non-null     int64  
 6   Number Of Ratings    62 non-null     int64  
 7   Number Of Reviews    62 non-null     int64  
 8   Upc                  62 non-null     object 
 9   Star Rating          62 non-null     float64
 10  Ram                  62 non-null     object 
dtypes: float64(1), int64(5), object(5)
memory usage: 5.5+ KB

Check number of unique value¶

In [7]:
df.nunique()
Out[7]:
Product Name           62
Product URL            62
Brand                   1
Sale Price             24
Mrp                    22
Discount Percentage    16
Number Of Ratings      19
Number Of Reviews      18
Upc                    62
Star Rating             3
Ram                     4
dtype: int64

Check missing value¶

In [8]:
df.isnull().sum()        # Clearly this shows there is no any null values in any column of the dataset
Out[8]:
Product Name           0
Product URL            0
Brand                  0
Sale Price             0
Mrp                    0
Discount Percentage    0
Number Of Ratings      0
Number Of Reviews      0
Upc                    0
Star Rating            0
Ram                    0
dtype: int64

Check duplicate value¶

In [9]:
df.duplicated().sum()
Out[9]:
0

Describe Statistically¶

In [10]:
df.describe().T
Out[10]:
count mean std min 25% 50% 75% max
Sale Price 62.0 80073.887097 34310.446132 29999.0 49900.0 75900.0 117100.0 140900.0
Mrp 62.0 88058.064516 34728.825597 39900.0 54900.0 79900.0 120950.0 149900.0
Discount Percentage 62.0 9.951613 7.608079 0.0 6.0 10.0 14.0 29.0
Number Of Ratings 62.0 22420.403226 33768.589550 542.0 740.0 2101.0 43470.0 95909.0
Number Of Reviews 62.0 1861.677419 2855.883830 42.0 64.0 180.0 3331.0 8161.0
Star Rating 62.0 4.575806 0.059190 4.5 4.5 4.6 4.6 4.7
In [11]:
# Q1.What are the Top 10 highest_rated iphones on Filpkart in india?
# Q2.How many ratings do the highest_rated iPhones on Filpkart have?
# Q3.Which iPhone has the highest number of reviews on Filpkart?
# Q4.What is the relationship between Sale price of iPhones and the number of ratings on Flipkart?
# Q5.What is the relationship between Discount percentage and the number of ratings on FlipKart?
# Q6.Can You figure out the least expensive and most expensive iPhone in the indian market along with all their satisfactions

Q1.What are the Top 10 highest_rated iphones on Filpkart in india?¶

In [12]:
highest_rated=df.sort_values(by=['Star Rating'], ascending=False)   # this will sort our data set on the basis of Star Rating column and put it in new data frame called Highest_rated
highest_rated=highest_rated.head(10)                                        # This will give the first 10 rows of the highest rated data set and reassign it to same variable. Now at this point Highest_rated data set will only have ten rows from the orginal dataset having the heighest rating phones.
highest_rated['Product Name']  
Out[12]:
20     APPLE iPhone 11 Pro Max (Midnight Green, 64 GB)
17         APPLE iPhone 11 Pro Max (Space Grey, 64 GB)
16    APPLE iPhone 11 Pro Max (Midnight Green, 256 GB)
15               APPLE iPhone 11 Pro Max (Gold, 64 GB)
14              APPLE iPhone 11 Pro Max (Gold, 256 GB)
0                    APPLE iPhone 8 Plus (Gold, 64 GB)
29                     APPLE iPhone 12 (White, 128 GB)
32          APPLE iPhone 12 Pro Max (Graphite, 128 GB)
35                     APPLE iPhone 12 (Black, 128 GB)
36                      APPLE iPhone 12 (Blue, 128 GB)
Name: Product Name, dtype: object

Q2.How many ratings do the highest_rated iPhones on Filpkart have?¶

In [13]:
iphone=highest_rated['Product Name'].value_counts()      # counts the value of rating of the heighest rated iphone
lable= iphone.index                                       # Looking at the index of the iphone data set
count= highest_rated['Number Of Ratings']                 # Heighest rating is reffered as count
graph= px.bar(highest_rated, x=lable, y=count, title='heighest rated iphone Vs their num. of rating') 
graph.show() 

Insight¶

According to the above graph.APPLE iPhone 8 plus(gold,64GB)has the most ratings on Filpkart.

Q3.Which iPhone has the highest number of reviews on Filpkart?¶

In [14]:
iphone=highest_rated['Product Name'].value_counts()      # counts the value of rating of the heighest rated iphone
lable= iphone.index                                       # Looking at the index of the iphone data set
count= highest_rated['Number Of Reviews']                 # Heighest rating is reffered as count
graph= px.bar(highest_rated, x=lable, y=count, title='No of reviews of highested_rated iPhones') 
graph.show() 

Insight¶

According to the above graph.APPLE iPhone 8 plus(gold,64GB)has the most reviews on Filpkart

Q4.What is the relationship between Sale price of iPhones and the number of ratings on Flipkart?¶

In [15]:
figure = px.scatter(df,x='Number Of Ratings',y='Sale Price',size ='Discount Percentage',trendline = 'ols',title ='Relationship between Sales Price and Number of Ratings ')
figure.show()

Insight¶

There is Negative linear realtionship between the sale price of iPhones and the number of ratings.it means iPhones with lower sale prices are sold more in india.

Q5.What is the relationship between Discount percentage and the number of ratings on FlipKart?¶

In [16]:
figure = px.scatter(df,x = 'Number Of Ratings' , y= 'Discount Percentage', size ='Sale Price' ,trendline = 'ols',
                    title = 'Relationship between Discount Price and Number of Ratings')
figure.show()

Insight¶

APPLE iPhone 8Plus(Gold,64GB) was the most appreciated iPhone in india iPhones with lower sale price are sold more in india iPhones with high discounts are sold more in india.

Q6.Can You figure out the least expensive and most expensive iPhone in the indian market along with all their satisfactions¶

In [17]:
Most_expensive = df.loc[df['Sale Price'].idxmax()]
Least_expensive = df.loc[df['Sale Price'].idxmin()]

#Display the result
print("Most_expesive Product:")
print(Most_expensive)

print("Least_expensive Product:")
print(Least_expensive)
Most_expesive Product:
Product Name                        APPLE iPhone 12 Pro (Silver, 512 GB)
Product URL            https://www.flipkart.com/apple-iphone-12-pro-s...
Brand                                                              Apple
Sale Price                                                        140900
Mrp                                                               149900
Discount Percentage                                                    6
Number Of Ratings                                                    542
Number Of Reviews                                                     42
Upc                                                     MOBFWBYZ5UY6ZBVA
Star Rating                                                          4.5
Ram                                                                 4 GB
Name: 24, dtype: object
Least_expensive Product:
Product Name                              APPLE iPhone SE (White, 64 GB)
Product URL            https://www.flipkart.com/apple-iphone-se-white...
Brand                                                              Apple
Sale Price                                                         29999
Mrp                                                                39900
Discount Percentage                                                   24
Number Of Ratings                                                  95807
Number Of Reviews                                                   8154
Upc                                                     MOBFWQ6BGWDVGF3E
Star Rating                                                          4.5
Ram                                                                 2 GB
Name: 52, dtype: object

According to the above result the Most expensive Product name is APPLE iPhone 12 Pro (Silver, 512 GB)¶

Conclusion¶

The conclusions we can infer from the above small analysis are

1) Apple iphone 8 plus(gold, 64GB) is the heighest rated phone in the flipkart with maximum number of review also.

2) Generally number of reviews are high for hight rated phones.

3) As sale price is more for the phone, the rating is low.

4) If the discount is given more, phone will gain more rating.

In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: